<%--
    Document   : locationManage
    Created on : Aug 31, 2011, 8:50:01 PM
    Author     : HIEP
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@taglib uri="http://java.fckeditor.net" prefix="fck" %>

<script type="text/javascript">
    function confirmDelete(){
        return confirm("Are you sure want delete this car rentail?");
    }
</script>

<!DOCTYPE html>
<div id="content" class="roundedBorders">
    <!-- Title -->
    <div id="title" class="b2">
        <h2>Manage Cars Rentals</h2>
    </div>
    <!-- Title -->
    <logic:notEmpty name="list">
        <!-- Inner Content -->
        <div id="innerContent">
            <!-- ListTable -->
            List Cars Rentals!
            <table cellspacing="0" class="listTable" id="postList">
                <!-- Thead -->
                <thead>
                    <tr>
                        <th class="first"><div></div></th>
                <th><a href="#">Fullname</a></th>
                <th><a href="#">Car Name </a></th>
                <th><a href="#">Pick up date</a></th>
                <th><a href="#">Drop up date</a></th>
                <th><a href="#">Price </a></th>
                <th class="last" colspan="2"><a href="#" title="Date">Action</a></th>
                </tr>
                </thead>
                <!-- /Thead -->
                <!-- Tfoot -->
                <tfoot>
                    <tr>
                        <td colspan="8">
                            <div class="inner">
                                <div class="paginate">
                                </div>
                            </div>
                        </td>
                    </tr>
                </tfoot>
                <!-- /Tfoot -->
                <!-- Tbody -->
                <tbody>
                    <logic:iterate name="list" id="item">
                        <tr>
                            <td><input type="checkbox" class="checkbox"/></td>
                            <td> 
                                <logic:notEmpty name="users">
                                    <logic:iterate name="users" id="user">
                                        <c:if test="${user.id == item.userId}">
                                            <c:out value="${user.fullname}"/>
                                        </c:if>
                                    </logic:iterate>
                                </logic:notEmpty>
                            </td>
                            <td>
                                <logic:notEmpty name="cars">
                                    <logic:iterate name="cars" id="car">
                                        <c:if test="${car.id == item.carId}">
                                            <c:out value="${car.name}"/>
                                        </c:if>
                                    </logic:iterate>
                                </logic:notEmpty>
                            </td>
                            <td>${item.pickUpDate}</td>
                            <td>${item.dropUpDate}</td>
                            <td>${item.price}</td>
                            <td><html:link action="/CarBookingAction.do?method=details&id=${item.id}">Details</html:link></td>
                                <td class="last">
                                <html:link onclick="return confirmDelete();" action="/CarBookingAction.do?method=delete&id=${item.id}">Delete</html:link>
                                </td>
                            </tr>
                    </logic:iterate>
                </tbody>
                <!-- /Tbody -->
            </table>
            <!-- /ListTable -->
        </div>
    </logic:notEmpty>
    <logic:notEmpty name="listDes">
        <!-- Inner Content -->
        <div id="innerContent">
            <!-- ListTable -->
            <table cellspacing="0" class="listTable" id="postList">
                <!-- Thead -->
                <thead>
                    <tr>
                        <th class="first"><div></div></th>
                <th><a href="#">Fullname</a></th>
                <th><a href="#">Car Name </a></th>
                <th><a href="#">Pick up date</a></th>
                <th><a href="#">Delete Date</a></th>
                <th><a href="#">Refund </a></th>
                <th class="last" colspan="2"><a href="#" title="Date">Action</a></th>
                </tr>
                </thead>
                <!-- /Thead -->
                <!-- Tfoot -->
                <tfoot>
                    <tr>
                        <td colspan="8">
                            <div class="inner">
                                <div class="paginate">
                                </div>
                            </div>
                        </td>
                    </tr>
                </tfoot>
                <!-- /Tfoot -->
                <!-- Tbody -->
                <tbody>
                    <logic:iterate name="listDes" id="item">
                        <tr>
                            <td><input type="checkbox" class="checkbox"/></td>
                            <td> 
                                <logic:notEmpty name="users">
                                    <logic:iterate name="users" id="user">
                                        <c:if test="${user.id == item.userId}">
                                            <c:out value="${user.fullname}"/>
                                        </c:if>
                                    </logic:iterate>
                                </logic:notEmpty>
                            </td>
                            <td>
                                <logic:notEmpty name="cars">
                                    <logic:iterate name="cars" id="car">
                                        <c:if test="${car.id == item.carId}">
                                            <c:out value="${car.name}"/>
                                        </c:if>
                                    </logic:iterate>
                                </logic:notEmpty>
                            </td>
                            <td>${item.pickUpDate}</td>
                            <td>${item.modifiedOn}</td>
                            <td>${item.refund}</td>
                            <td><html:link action="/CarBookingAction.do?method=details2&id=${item.id}">Details</html:link></td>
                                <td class="last">
                                <html:link onclick="return confirmDelete();" action="/CarBookingAction.do?method=delete&id=${item.id}">Delete</html:link>
                                </td>
                            </tr>
                    </logic:iterate>
                </tbody>
                <!-- /Tbody -->
            </table>
            <!-- /ListTable -->
            <div style="height: 100px;">
            </div>
        </div>
    </logic:notEmpty>
    <!-- /Inner Content -->
    <div class="bBottom"><div></div></div>
</div>

